home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 October
/
Ahoy_Magazine_85-10_1985_Double_L.d64
/
1541 clean
(
.txt
)
next >
Wrap
Commodore BASIC
|
2022-10-26
|
6KB
|
203 lines
1 rem 1541 disk drive cleaning utility
2 rem author - john derosa & the ahoy! staff
3 print"[147]":poke53280,11:poke53281,11
4 print"[158]the 1541 disk cleaning utility[156]"
5 print"[156][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
6 print"[194] 1541 [194]"
7 print"[194] [176][192][192][192][192][184][184][184][184][184][184][192][192][192][192][192][174] [194]"
8 print"[194] [171][192][192][192][192][162][162][162][162][162][162][192][192][192][192][192][179] [194]"
9 print"[194] [194][210] [194] [194]"
10 print"[194][209][173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189] [194]"
11 print"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
12 print"[158] by john derosa"
13 print" for ahoy! magazine[156]"
19 forz=1to6000:next
20 d$=" ":aa=0
30 print "[147] enter current date? ";
40 get a$:if a$="" then 40
50 if a$=chr$(13) then 100
60 print a$;:d$=d$+a$:goto 40
100 rem initialize screen
110 gosub 1200
120 print "do you want to read data from disk?(y/n)"
130 gosub 2500
140 gosub 1200
150 if an$="n" then 340
200 rem read data from disk drive
210 print " insert data disk"
220 print " press any key to read data"
230 get an$:if an$="" then 230
240 open15,8,15:open2,8,2,"cleandata,s,r"
250 gosub 1300
260 if a <> 0 then 300
270 input#2,dt$,tr,sc,nc,nm
280 gosub 1300
290 if a = 0 then 390
300 print " data not read from disk"
310 print " try again ? (y/n)"
320 gosub 2500
330 if an$="y" then close 2:gosub 1200:goto 200
340 gosub 1200:dt$=d$:tr=2:sc=30:nc=0:nm=15
350 print " data not read from disk"
360 print " default values used"
370 print " press any key to continue"
380 get an$:if an$="" then 380
390 close 2:close 15
400 rem display auto data
410 print "[147]"
420 print " current date is ";d$;"[146]"
430 print " last date cleaned is: ";dt$
440 print " current track is: ";tr
450 print " current cleaning time is (sec): ";sc
460 print " number of times disk used is: ";nc
470 print " maximum cleanings per disk is: ";nm
480 print " number of cleanings left is: ";nm-nc;"[146]"
490 print " do you want to change data? (y/n)"
495 gosub 2500:if an$="n" then 800
500 rem change auto data
510 print "[147]"
520 print " last date cleaned is ";dt$
530 print " enter new date";:input dt$
540 print " current track is ";tr
550 print " enter new track (1-35)";:input tr
560 if tr<1 then print "[145][145][145][145]":goto 540
570 if tr>35 then print "[145][145][145][145]":goto 540
590 print " current cleaning time is ";sc
600 print " enter new time (< 300)";:input sc
610 if sc>300 then print "[145][145][145][145]":goto 590
620 if sc<1 then print "[145][145][145][145]":goto 590
630 print " number of times disk used is ";nc
640 print " enter new number ";:input nc
650 print " maximum cleanings per disk is";nm
660 print " enter new maximum ";:input nm
670 print " do you want to change data? (y/n)"
680 gosub 2500
690 if an$="y" then 500
700 print " save this data on disk (y/n)"
710 gosub 2500
720 if an$="y" then gosub 1400
800 rem auto cleaning
805 gosub 1200:gosub 1000
810 nl=nm-nc
815 if nl>o then 870
820 print " *****warning*****"
825 print " cleaning disk is used up"
830 print " (";nl;" cleanings left on disk)"
835 print " do you want to continue cleaning? (y/n)"
840 gosub 2500
845 if an$="y" then gosub 1200:gosub 1000:goto 870
850 print " do you want to change data? (y/n)"
855 gosub 2500
860 if an$="y" then 500
865 goto 955
870 gosub 2200:gosub 1200:gosub 1000
875 print " insert cleaning disk in drive"
880 print " press any key to start cleaning"
885 get an$:if an$="" then 885
890 gosub 1200:gosub 1000
895 print " cleaning[146]"
900 print " press any key to manually stop"
905 if et>sc then 920
910 gosub 1700
915 get an$:if an$="" then 905
920 gosub 2000:gosub 1200:gosub 1000
925 print " update data disk? (y/n)"
930 gosub 2500
935 if an$="n" then 955
940 nc=nc+1:tr=tr+2:dt$=d$
945 if tr>35 then tr=1
950 gosub 1400
955 print "[147] program ended":end
1000 rem subroutine-update status line
1010 if mf=1 then 1040
1020 poke 1266,143:poke 1267,134:poke 1268,134
1030 goto 1050
1040 poke 1266,143:poke 1267,142:poke 1268,32
1050 t=tr/10:if t<1 then t2=-144:t1=tr:goto 1070
1060 t1=int(t):t2=tr-10*t1
1070 poke 1277,t1+176:poke 1278,t2+176
1075 s=sc/100:if s<1 then s0=0:goto 1077
1076 s0=int(s)
1077 sa=sc-s0*100
1080 s=sa/10:if s<1 then s2=sa:s1=0:goto 1100
1090 s1=int(s):s2=sa-10*s1
1100 poke 1287,s0+176:poke 1288,s1+176:poke 1289,s2+176
1105 e=et/100:if e<1 then e0=0:goto 1107
1106 e0=int(e)
1107 ea=et-e0*100
1110 e=ea/10:if e<1 then e2=ea:e1=0:goto 1130
1120 e1=int(e):e2=ea-10*e1
1130 poke 1298,e0+176:poke 1299,e1+176:poke 1300,e2+176
1140 return
1200 rem subroutine-set up screen
1210 print "[147]"spc(4)"1541 disk drive cleaning utility"
1220 print " drive head at total elapsed"
1230 print " motor track seconds seconds"
1240 print "[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
1250 return
1300 rem subroutine-read error channel
1310 input#15,a,b$,c,d
1320 if a=0 then return
1340 gosub 1200:gosub 1000
1350 print " disk error * ";b$
1360 close 15
1370 return
1400 rem subroutine-save auto data
1410 gosub 1200:gosub 1000
1420 print " insert data disk"
1430 print " press any key to save auto data "
1440 get an$:if an$="" then 1440
1450 open 15,8,15:open2,8,2,"@0:cleandata,s,w"
1460 gosub 1300:if a <> 0 then 1500
1470 print#2,dt$;",";tr;",";sc;",";nc;",";nm
1480 gosub 1300:if a <> 0 then 1500
1490 close2:close15:return
1500 print " data not saved!"
1520 print " try again? (y/n)"
1530 gosub 2500:close 2:close 15
1540 if an$="n" then return
1550 goto 1400
1700 rem subroutine-motor on
1710 if mf=1 then 1730
1720 z=54272:tt=ti:for l=z to z+24:poke l,0:next l
1730 poke z+5,9:poke z+6,0:pokez+24,15:poke z+4,33
1740 et=int((ti-tt)/60)
1750 if sw=1 then 1770
1760 poke z+1,25:poke z,170:sw=1:goto 1780
1770 poke z+1,20:poke z,150:sw=0
1780 gosub 1000:poke z+4,32
1790 if mf=1 then return
1800 open15,8,15
1810 print#15,"m-r"chr$(0)chr$(28)
1820 get#15,x$:x=asc(x$+chr$(0))
1830 bi=xor4
1840 print#15,"m-w"chr$(0)chr$(28)chr$(1)chr$(bi)
1850 mf=1:close 15
1860 return
2000 rem subroutine-motor off
2010 z=54272:for l=z to z+24:poke l,0:next l
2020 open15,8,15
2030 bi=x
2040 print#15,"m-w"chr$(0)chr$(28)chr$(1)chr$(bi)
2050 mf=0:close 15
2060 return
2200 rem subroutine-move head to track
2220 print " insert any formatted disk"
2230 print " press any key to move head"
2240 get an$:if an$="" then 2240
2250 open 15,8,15:open 2,8,2,"#"
2260 print#15,"u1 2 0";tr;"0"
2270 gosub 1300
2280 if a=0 then close 2:close 15:return
2290 print " move head failed"
2300 print " head not on proper track"
2400 print " try again? (y/n)"
2410 gosub 2500:close 2:close 15
2420 if an$="y" then gosub 1200:gosub 1000:goto 2220
2430 return
2500 rem subroutine - get (y/n) answer
2510 get an$:if an$="" then 2510
2520 if an$="y" then return
2530 if an$="n" then return
2540 goto 2510